package com.ghpt.controller;
import com.ghpt.pojo.YaSuoShi;
import com.ghpt.service.YaSuoShiService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/yasuo")
public class YaSuoShiController {
    private final YaSuoShiService yaSuoShiService;

    public YaSuoShiController(YaSuoShiService yaSuoShiService) {
        this.yaSuoShiService = yaSuoShiService;
    }
    @GetMapping("/{id}")
    public YaSuoShi getYaSuoShiById(@PathVariable Long id) {
        System.out.println("结果是"+yaSuoShiService.findYaSuoShiById(id));
        return yaSuoShiService.findYaSuoShiById(id);
    }
    @PutMapping
    public int updateYaSuoShi(@RequestBody YaSuoShi yaSuoShi) {
        return yaSuoShiService.updateById(yaSuoShi);
    }
}
